<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>骨医快线</title>
    <link href="../../../css/mui.plus.css" rel="stylesheet" />
    <style>
    	.mui-table-view-cell>a {
    		white-space: normal!important;
    	}
    </style>
</head>
<body>
	<header class="mui-bar mui-bar-nav oe-pri-bar">
	    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	    <h1 class="mui-title">随访记录</h1>
	</header>
	
    <div class="mui-content oe-helper">
    	<ul id="list-input" class="mui-table-view">
	        <li class="mui-table-view-cell">
	            <a class="mui-navigate-right">
					术后1月
	            </a>
	        </li>
	        <li class="mui-table-view-cell">
	            <a class="mui-navigate-right">
					术后3月
	            </a>
	        </li>
	        <li class="mui-table-view-cell">
	            <a class="mui-navigate-right">
					术后6月
	            </a>
	        </li>
	        <li class="mui-table-view-cell">
	            <a class="mui-navigate-right">
					术后12月
	            </a>
	        </li>
	    </ul>
    </div>
    
    <script id="tmp-list-input" type="text/html">
    	{{if data}}
		<ul id="list-followup" class="mui-table-view">
	        <li class="mui-table-view-cell" data-status="case_followup_1month_nms">
	            <a class="{{data.case_followup_1month_nms ? '' : 'mui-navigate-right'}}">
					术后1月
				{{if data.case_followup_1month_nms}}
					<span class="mui-pull-right">NMS量表得分：{{data.case_followup_1month_nms}}分</span>
				{{/if}}
	            </a>
	        </li>
	        <li class="mui-table-view-cell" data-status="case_followup_3month_nms">
	            <a class="{{data.case_followup_3month_nms ? '' : 'mui-navigate-right'}}">
					术后3月
				{{if data.case_followup_3month_nms}}
					<span class="mui-pull-right">NMS量表得分：{{data.case_followup_3month_nms}}分</span>
				{{/if}}
	            </a>
	        </li>
	        <li class="mui-table-view-cell" data-status="case_followup_6month_nms">
	            <a class="{{data.case_followup_6month_nms ? '' : 'mui-navigate-right'}}">
					术后6月
				{{if data.case_followup_6month_nms}}
					<span class="mui-pull-right">NMS量表得分：{{data.case_followup_6month_nms}}分</span>
				{{/if}}
	            </a>
	        </li>
	        <li class="mui-table-view-cell" data-status="case_followup_1year_nms">
	            <a class="{{data.case_followup_1year_nms ? '' : 'mui-navigate-right'}}">
					术后12月
				{{if data.case_followup_1year_nms}}
					<span class="mui-pull-right">NMS量表得分：{{data.case_followup_1year_nms}}分</span>
				{{/if}}
	            </a>
	        </li>
	    </ul>
    	{{/if}}
    </script>

    <script src="../../../js/mui.min.js"></script>
    <script src="../../../js/app.js"></script>
    <script src="../../../js/lib/template.js"></script>
    <script>
    	(function($, a){
    		var wv,
    			caseId,
    			html,
    			type,
    			tmpData,
    			commitData;
    			
//  		$('body').on('tap', '#btn-commit', function(){
//  			commitData = app.form.getJsonFromForm('list-input');
//  			commitData.case_id = caseId;
//  			
//  			CommitDataById(commitData);
//  		});

			window.addEventListener('refresh', function(){
				getCaseInfoById(caseId, type);
			})
    		
    		$('#list-input').on('tap', 'li', function(){
    			var self = this;
    			$.openWindow({
    				url: '../../scale/detail.html',
    				waiting: {
    					autoShow: false
    				},
    				extras: {
    					rs_id: '62',
    					case_id: caseId,
    					case_status: self.dataset.status
    				}
    			});
    		});
    		
    		$.plusReady(function(){
    			wv = plus.webview.currentWebview();
    			caseId = wv.caseId;
    			type = wv.type;
				
				getCaseInfoById(caseId, type);
    		});
    		
    		var getCaseInfoById = function(caseId, type){
    			app.net.get('c_old_man_hip_broke_prj_case_test/show_by_type', {case_id: caseId, case_type: type}, function(data){
    				if(data && data.code === '100') {
    					tmpData = data;
    					html = template('tmp-list-input', tmpData);
    					document.getElementById("list-input").innerHTML = html
    				}
    			});
    		}
    		
    		var CommitDataById = function(commitData){
    			app.net.post('c_old_man_hip_broke_prj_case_test/update', commitData, function(data){
    				if(data && data.code === '100') {
    					$.toast('保存成功');
    					$.back()
    				}; 
    			});
    		}
    		
    	}(mui, app));
    </script>
</body>
</html>